package org.yasukusury.crawler.variation;

import org.jsoup.helper.StringUtil;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import org.yasukusury.crawler.dao.Copy;
import org.yasukusury.crawler.helper.Result;

import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Y
 * Date: 2017-11-14
 * Time: 18:19
 */
public abstract class AbstractBatches implements Runnable {

    protected ConcurrentLinkedDeque<Copy> list;
    protected String asin;
    protected int pages;
    protected String pageNum;
    protected int copyCount;

    abstract void start() throws InterruptedException;

    abstract void pageTraverse() throws InterruptedException;

    abstract void fillCopies() throws InterruptedException;

    abstract String dateparse(String text);

    @Override
    public void run() {
        try {
            start();
        } catch (InterruptedException e) {
            System.out.println(String.format("ASIN : %s 评论链接连接失败", asin));
        }
    }
}
